CC = g++
AS = nasm

ifeq ($(ARCH), x86)
	asm_format = elf
	file = sum_x86.asm
else
	asm_format = elf64
	file = sum_x86_64.asm
endif

CFLAGS = -Wall -Wextra -O0 -c
ASFLAGS = -f $(asm_format)

all: sum.o sum_asm.o
	$(CC) -o sum $^

sum.o: sum.c
	$(CC) $(CFLAGS) -o $@ $^

sum_asm.o: $(file)
	$(AS) $(ASFLAGS) -o $@ $^

clean:
	rm *exe *o sum
